package com.ouc.yyi.swaggerTest;
//
//                       _oo0oo_
//                      o8888888o
//                      88" . "88
//                      (| -_- |)
//                      0\  =  /0
//                    ___/`---'\___
//                  .' \\|     |// '.
//                 / \\|||  :  |||// \
//                / _||||| -:- |||||- \
//               |   | \\\  -  /// |   |
//               | \_|  ''\---/''  |_/ |
//               \  .-\__  '-'  ___/-. /
//             ___'. .'  /--.--\  `. .'___
//          ."" '<  `.___\_<|>_/___.' >' "".
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//         \  \ `_.   \_ __\ /__ _/   .-` /  /
//     =====`-.____`.___ \_____/___.-`___.-'=====
//                       `=---='
//
//
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//               佛祖保佑         永无BUG
//

import com.ouc.yyi.pojo.User;
import com.ouc.yyi.service.FindUserByIdService;
import com.ouc.yyi.service.impl.findUserByIdServiceImpl;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: yyi
 * @date: 2019/3/12 18:17
 * @parameters:
 * @desc:
 **/

@Api(tags = "swaggerController", description = "swaggerController测试")
@RestController
public class SwaggerController {
    @Autowired
    private FindUserByIdService findUserByIdService;
    //查
    @GetMapping(value = "/helloswagger/{id}",produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value="输入id查找用户", notes="请输入id")
    @ApiImplicitParam(name = "id", value = "用户id")
    public User index(@PathVariable("id") Integer id){
        User user = findUserByIdService.selectUserById(id);
        //User user = list.get(0);
        //redisUtil.set("yyi",user);
        return user;
    }
    //添加用户
    @PostMapping(value = "/addUser", produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value="添加用户", notes="实体类")
    //@ApiImplicitParam(name = "user", value = "用户")
    public boolean addUser(@ApiParam(value = "user") User user){
        return findUserByIdService.insertUser(user);
    }
}
